import os
import tornado.ioloop
import tornado.web


class IndexHandler(tornado.web.RequestHandler):
    def get(self, pk):
        print('pk', pk)
        self.render('index.html')

    def post(self, pk):
        # breakpoint()
        # self.request.files
        self.write('post ok')


def make_app():
    return tornado.web.Application([
        (r'/(\d*)', IndexHandler),
    ], debug=True,
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        static_path=os.path.join(os.path.dirname(__file__), "static"),
    )


if __name__ == '__main__':
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()
